"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogCoinDao = void 0;
const DbConfig_1 = require("../../src/config/DbConfig");
const DaoBase_1 = require("../../src/engine/dao/DaoBase");
const MysqlManager_1 = require("../../src/engine/utils/MysqlManager");
class LogCoinDao extends DaoBase_1.DaoBase {
    static add_user_coin_log(userid, coin, operator, time, reseason) {
        return __awaiter(this, void 0, void 0, function* () {
            let client = yield MysqlManager_1.MysqlManager.instance.getDb(this.DB_NAME);
            let sql = `INSERT INTO t_log_coin(userid, coin,operator,time, reseason) VALUES(?,?,?,?,?) ;`;
            let sqlParams = [userid, coin, operator, time, reseason];
            let results = yield client.queryPromise(sql, sqlParams);
            if (results && results["affectedRows"] > 0) {
                return true;
            }
            else {
                return false;
            }
        });
    }
    static get_log_coin(startTimeStr, endTimeStr) {
        return __awaiter(this, void 0, void 0, function* () {
            let client = yield MysqlManager_1.MysqlManager.instance.getDb(this.DB_NAME);
            let sql = "select * from t_log_coin WHERE time >= ? and time <= ?  ";
            sql += " order by time desc ";
            let sqlParams = [startTimeStr, endTimeStr];
            let results = yield client.queryPromise(sql, sqlParams);
            return results;
        });
    }
}
exports.LogCoinDao = LogCoinDao;
LogCoinDao.DB_NAME = DbConfig_1.DbConfig.Db_Name.db_admin;
